package springTaskExecutor.config;

import org.springframework.beans.factory.support.MethodReplacer;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * @author CKC
 * @DateTime 2022/3/15 14:51
 */
//@Component
public class MethodReplacerDemo implements MethodReplacer {
    @Override
    public Object reimplement(Object obj, Method method, Object[] args) throws Throwable {
        if (method.getName().contains("getInfo")) {
            return Thread.currentThread().getName() + ":  123";
        }
        return method.invoke(args);
    }
}
